package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class WechatUserComplaintRequest extends Request{

	private static final long serialVersionUID = 7111084241764410838L;

	private Integer openPlatformId;
	private String openId;
	private String content;
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.openId = requestInfo.getParameter(ApiUrlParamEnum.openId.getParamName(), "");
		this.openPlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.openPlatformId.getParamName(), 0);
		this.content = requestInfo.getParameter(ApiUrlParamEnum.content.getParamName(), "");
		
		if(openId.equals("")){
			throw new RequestIllegalException("error openId: " + openId);
		}
		
		if(openPlatformId == 0){
			throw new RequestIllegalException("error openPlatformId: " + openPlatformId);
		}
		
		if(content.equals("")){
			throw new RequestIllegalException("error context: " + content);
		}
	}

	public Integer getOpenPlatformId() {
		return openPlatformId;
	}

	public void setOpenPlatformId(Integer openPlatformId) {
		this.openPlatformId = openPlatformId;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}


}
